var { initObj, formatObj } = require('../libs/common');

var init = function (data) {
    return initObj(mod, data);
}

var format = function (data) {
    return formatObj(mod, data);
}

// 聊天消息记录表
var mod = {
    type: {
        name: '消息类型',
        type: 'string',
        length: 50
    },
    messageId:{
        name: '消息id',
        type: 'string',
        length: 100
    },
    timestamp:{
        name: '发送时间',
        type: 'string',
        length: 100
    },
    senderId:{
        name: '发送方',
        type: 'string',
        length: 100
    },
    receiverId:{
        name: '接收方',
        type: 'string',
        length: 100
    },
    groupId:{
        name: '群消息的群id',
        type: 'string',
        length: 100
    },
    payload: {
        name: '消息体',
        type: 'string',
        length: 5000
    },
    createtime: {
        name: '创建时间',
        type: 'date',
        default: new Date()
    },
    updatetime: {
        name: '更新时间',
        type: 'date',
        default: new Date()
    }
};

module.exports = {
    init,
    format
};